package com.sskj.gocoin.p.activity;

import com.lzy.okgo.OkGo;
import com.lzy.okgo.model.Response;
import com.sskj.gocoin.m.HttpConfig;
import com.sskj.gocoin.m.bean.HttpData;
import com.sskj.gocoin.m.bean.XiTongBean;
import com.sskj.gocoin.m.http.JsonCallBack;
import com.sskj.gocoin.p.base.BasePresenter;
import com.sskj.gocoin.v.activity.AboutUsActivity;

/**
 * <pre>
 *     author : wk_math
 *     e-mail : wk_math@163.com
 *     time   : 2018/03/30
 *     desc   :
 *     version: 1.0
 * </pre>
 */

public class AboutUsPresenter extends BasePresenter<AboutUsActivity> {

    public void getEmail() {
        OkGo.<HttpData<XiTongBean>>post(HttpConfig.BASE_URL + HttpConfig.GET_EMAIL)
                .execute(new JsonCallBack<HttpData<XiTongBean>>(this) {
                    @Override
                    protected void _onSuccess(Response<HttpData<XiTongBean>> response) {
                        HttpData<XiTongBean> httpData = response.body();
                        if (httpData.getStatus() == 200) {
                            mView.setEmail(httpData.getData().email);
                        }
                    }
                });

    }

    public void  getContent(){
        OkGo.<HttpData<String>> get(HttpConfig.BASE_URL+HttpConfig.GET_XIEYI)
                .params("type","faq")
                .execute(new JsonCallBack<HttpData<String>>(this) {
                    @Override
                    protected void _onSuccess(Response<HttpData<String>> response) {
                        if (response.body().status==200){
                            mView.setContent(response.body().getData());
                        }
                    }
                });
    }
}
